<template>
  <div class="pwd">
    <div class="title">{{ '请输入' + '"' + user.username + '"' + '的新密码' }}</div>
    <el-input v-model="pwd" placeholder="请输入新密码" show-password></el-input>
  </div>
</template>

<script setup name="x-pwd">
import md5 from 'js-md5'
import useStore from '@/stores/modules/sys/user';
const users = useStore();
const pwd = ref("")
const user = ref({});
const render = (data) => {
  console.log(data, '233');
  user.value = data;
}

const submit = async () => {
  if (Helper.empty(pwd.value)) {
    Msg.error("请输入新密码")
    return
  }

  user.value.password = pwd.value;

  let result = await users.modify(user.value)
  if (result) {
    Dialog.close()
  }
}

defineExpose({ submit, render })
</script>

<style scoped lang="less">
.pwd {
  padding: 10px 0;
  box-sizing: border-box;

  .title {
    margin-bottom: 15px;
    font-size: 14px;
    color: #606266;
    box-sizing: border-box;
  }
}
</style>
